package com.why.blog.config.dozer;

import org.apache.ibatis.annotations.Mapper;
import org.dozer.spring.DozerBeanMapperFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

/**
 * description: Bean 转换
 *
 * 感谢 @author:  taohan
 * @date: 2019年03月29日
 * @time: 13:49
 */

@Configuration
public class DozerMapper {

	/**
	 * Dozer 整合 Spring 映射 Bean
	 * @return
	 */
	@Bean
	public DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean() {
		DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean = new DozerBeanMapperFactoryBean();
		//Mapping Resources
		Resource[] resources = {new ClassPathResource("/dozer/mapping/dozer-mapping-new.xml")};
		dozerBeanMapperFactoryBean.setMappingFiles(resources);
		
		return dozerBeanMapperFactoryBean;
	}
}
